package com.zyz.system.controller.user;

import com.zyz.common.core.model.Result;
import com.zyz.common.core.model.TableDataInfo;
import com.zyz.system.model.user.dto.UserQueryDTO;
import com.zyz.system.model.user.dto.UserStatusDTO;
import com.zyz.system.service.user.IUserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
@Tag(name = "用户接口")
public class UserController {

    @Autowired
    private IUserService userService;

    @Operation(summary = "用户列表查询")
    @RequestMapping(value = "/list",method = RequestMethod.GET)
    public TableDataInfo list (UserQueryDTO userQueryDTO) {
        return userService.list(userQueryDTO);
    }

    @Operation(summary = "更新用户状态")
    @RequestMapping(value = "/updateStatus",method = RequestMethod.PUT)
    public Result<Void> updateStatus (@RequestBody UserStatusDTO userStatusDTO) {
        userService.updateStatus(userStatusDTO);
        return Result.ok();
    }

}
